<?php
namespace app\index\controller;
use think\Controller;
use think\Db;

class Index extends Controller
{
    public function index()
    {
        $data = Db::name('think_data')->find();
        $this->assign('result', $data);
        return $this->fetch();
    }

    public function hello($name="thinkPHP") {
        $this->assign('name', $name);
        return $this->fetch();
    }

    public function request($name="request") {
        echo "url:" . $this->request->url();
        echo "hello" . $name;
    }

    public function testname($name='') {
        if($name = "thinkPHP") {
            return redirect('http://thinkphp.cn');
        }else {
            $this->error("错误的name", 'guest');
        }
    }

    protected function hello1() {
        return '无法通过外部URL进行访问!';
    }



}